﻿@{
    ViewBag.Title = "TimeDiffDemo";
    Layout = "~/Views/Shared/_Page.cshtml";
}

<h2>Time Diff Demo</h2>

<script type="text/javascript">
    window.onload = function () {
        // milliseconds from 1/1/1970 to today
        var today = new Date();

        // milliseconds from 1/1/1970 to next new year
        var newYear = new Date(2016, 0, 1);

        // calculate milliseconds from today to next year
        var timeDiff = newYear - today;

        ZEUS.DEBUG.log("today: " + today);
        ZEUS.DEBUG.log("new year: " + newYear);
        ZEUS.DEBUG.log("time diff: " + timeDiff);
        ZEUS.DEBUG.log("time diff(second): " + timeDiff / 1000);
        ZEUS.DEBUG.log("time diff(minute): " + timeDiff / (1000 * 60));
        ZEUS.DEBUG.log("time diff(hour): " + timeDiff / (1000 * 60 * 60));
        ZEUS.DEBUG.log("time diff(day): " + timeDiff / (1000 * 60 * 60 * 24));
    }
</script>